import { CAROUSEL, HANDLE_CAROUSEL, CAROUSELGROUP } from './api';
import { request, METHOD, axios } from '@/utils/request';

//获取所有轮播图
export async function getCarousel(params) {
  return request(CAROUSEL + '/getAll', METHOD.GET, params);
}
//添加轮播图
export async function uploadCarousel(params) {
  console.log(params);
  return request(CAROUSEL + '/create', METHOD.POST, params);
}
//更新轮播图
export async function updateCarousel(params) {
  return request(HANDLE_CAROUSEL + 'update/', METHOD.PUT, params);
}
//删除轮播图
export async function deleteCarousel(params) {
  return request(HANDLE_CAROUSEL + 'delete/', METHOD.DELETE, params);
}

// 获取轮播图分组
export async function getCarouselGroup(params) {
  return request(CAROUSELGROUP + '/get', METHOD.GET, params);
}

// 新增轮播图分组
export async function addCarouselGroup(params) {
  return request(CAROUSELGROUP + '/create', METHOD.POST, params);
}
// 删除轮播图分组
/* 这里必须不一样 别问为什么 */
export async function delCarouselGroup(params) {
  return axios.delete(CAROUSELGROUP + '/delete', {
    data: params,
  });
}

export default {
  getCarousel,
  uploadCarousel,
  updateCarousel,
  deleteCarousel,
  getCarouselGroup,
  addCarouselGroup,
  delCarouselGroup,
};
